package algebra.rewriting.kfree;

import utils.ExecTime;
import utils.exception.CoreReasoningException;
import utils.exception.SyntaxParsingException;
import utils.parser.Parser;
import entities.concept.Concept;
import entities.concept.ExistsConcept;
import entities.role.Role;
import algebra.query.pd.*;

public class TestApproximate {

	/**
	 * @param args
	 * @throws SyntaxParsingException 
	 * @throws CoreReasoningException 
	 */
	public static void main(String[] args) throws SyntaxParsingException, CoreReasoningException {
		String cs = "(= (role g) 3)";
		Concept c = Parser.conParser(Parser.getListOfTokensFromTokenizer(cs), null);
		ProjDesc sub = new PdConjunction(new PdFeature(Role.createRoleAsIs("f")), 
				new PdConcept(Parser.conParser(Parser.getListOfTokensFromTokenizer("B"), null))
				);
		Role r= Role.createRoleAsIs("R");
		ProjDesc pd1= new PdConcept(new ExistsConcept(r, c));
		ProjDesc pd2 = new PdRole(r, 
				sub
				);
		ExecTime timer = ExecTime.getStarted();
		boolean ok = KFreeApproximate.isIncluded(pd1, pd2);
		System.err.println("Time: "+timer.getTime()/1000.0 + "; "+ok);
	}

}
